﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="imageAddComments.aspx.vb" Inherits="Web_2._0_BMW___X6_Experts_Web_Application.imageAddComments" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">

        .tags
        {
            height: 184px;
            width: 485px;
        }
        .newTags
        {
            height: 125px;
        }
        .commentB
        {
            height: 489px;
            width: 914px;
        }
        .pCommentB
        {
            width: 372px;
            height: 272px;
        }
        .addNewImageContent
        {
            width: 495px;
            height: 188px;
        }
        .listOfAssignedTags
        {
            width: 244px;
            height: 98px;
        }
        .postTagsInfo
        {
            width: 239px;
        }
        .style2
        {
            font-weight: normal;
        }
        .Like
        {
            width: 395px;
            height: 14px;
            text-align: center;
        }
        .space
        {
            height: 46px;
            width: 395px;
        }
        .spaceLike
        {
            height: 19px;
        }
        </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div id="imageCommentA">
        <div class ="commentB" style="font-size: x-large; font-weight: bolder;">
            <p style="text-decoration: underline">
                Comments</p>
            <div class = "text100" 
            style="font-size: small; font-weight: normal; font-style: normal">
        
        
        
            So, you like your BMW - X6&#39;s then why not comment on this picture? It doesnt 
            cost you anything...<br />
                <br />
                Simply enter your comment below and press comment. You can also place several 
                tags on the picture by selecting your preffered tags and clicking on tag image. 
                If you cant find a tag which your looking for, enter it in the filed below and 
                click on add new tag. It&#39;s simple as that! <br />
                </div>
            <div class = "pCommentC">
                <br />
                <asp:FormView ID="FormView1" runat="server" DataSourceID="SqlDataSource3" 
            Height="204px" Width="494px" BorderStyle="Solid" Font-Size="Large" 
            CssClass="pCommentC" >
                    <EditItemTemplate>
                        <strong>Description:</strong>
                        <asp:TextBox ID="ImageDescriptionTextBox" runat="server" 
                    Text='<%# Bind("ImageDescription") %>' />
                        <br />
                        <strong>Date Uploaded:</strong>
                        <asp:TextBox ID="DateUploadedTextBox" runat="server" 
                    Text='<%# Bind("DateUploaded") %>' />
                        <br />
                        <strong>Time Uploaded:</strong>
                        <asp:TextBox ID="TimeUploadedTextBox" runat="server" 
                    Text='<%# Bind("TimeUploaded") %>' />
                        <br />
                        <strong>Uploaded by:</strong>
                         <a href="UserProfileView.aspx?Username=<%# Eval("UserName") %>"><asp:Label ID="UserNameLabel" runat="server" Text='<%# Eval("UserName") %>' /></a>
                        <br />
                        <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" 
                    CommandName="Update" Text="Update" />
                &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" 
                    CausesValidation="False" CommandName="Cancel" Text="Cancel" />
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <strong>Description:</strong>
                        <asp:TextBox ID="ImageDescriptionTextBox0" runat="server" 
                    Text='<%# Bind("ImageDescription") %>' />
                        <br />
                        <strong>Date Uploaded:</strong>
                        <asp:TextBox ID="DateUploadedTextBox0" runat="server" 
                    Text='<%# Bind("DateUploaded") %>' />
                        <br />
                        <strong>Time Uploaded:</strong>
                        <asp:TextBox ID="TimeUploadedTextBox0" runat="server" 
                    Text='<%# Bind("TimeUploaded") %>' />
                        <br />
                        <strong>Uploaded by:</strong>
                         <a href="UserProfileView.aspx?Username=<%# Eval("UserName") %>"><asp:Label ID="UserNameLabel" runat="server" Text='<%# Eval("UserName") %>' /></a>
                        <br />
                        <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" 
                    CommandName="Insert" Text="Insert" />
                &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" 
                    CausesValidation="False" CommandName="Cancel" Text="Cancel" />
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <strong>Description:</strong>
                        <asp:Label ID="ImageDescriptionLabel" runat="server" 
                    Text='<%# Bind("ImageDescription") %>' />
                        <br />
                        <br />
                        <strong>Date Uploaded:</strong>
                        <asp:Label ID="DateUploadedLabel" runat="server" 
                    Text='<%# Bind("DateUploaded") %>' />
                        <br />
                        <br />
                        <strong>Time Uploaded:</strong>
                        <asp:Label ID="TimeUploadedLabel" runat="server" 
                    Text='<%# Bind("TimeUploaded") %>' />
                        <br />
                        <br />
                        <strong>Uploaded by:</strong>
                        <a href="UserProfileView.aspx?Username=<%# Eval("UserName") %>"><asp:Label ID="UserNameLabel" runat="server" Text='<%# Eval("UserName") %>' /></a>
                        <br />
                    </ItemTemplate>
                </asp:FormView>
                <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
            ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" 
            SelectCommand="SELECT Images.ImageDescription, Images.DateUploaded, Images.TimeUploaded, aspnet_Users.UserName, Images.ImageID FROM (Images INNER JOIN aspnet_Users ON Images.UserIDFK = aspnet_Users.UserId) WHERE (Images.ImageID = ?)">
                    <SelectParameters>
                        <asp:QueryStringParameter Name="?" QueryStringField="id" />
                    </SelectParameters>
                </asp:SqlDataSource>
            </div>
            <div class = "pCommentB">
                <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        DataSourceID="SqlDataSource1" Height="147px" PageSize="1" Width="340px" 
            style="margin-right: 4px">
                    <Columns>
                        <asp:ImageField DataAlternateTextField="ImageLink" 
                DataImageUrlField="ImageLink" HeaderText="***Image Comments***">
                            <ControlStyle CssClass="imageCommentsImage" />
                            <FooterStyle CssClass="imageCommentsImage" />
                            <HeaderStyle Height="0px" />
                            <ItemStyle BorderStyle="None" CssClass="imageCommentsImage" />
                        </asp:ImageField>
                       
                    </Columns>
                </asp:GridView>
            </div>
            <div class = "Like">
            <div class = "spaceLike">
            
            </div>

                <asp:Image ID="imgLike" runat="server" Height="35px" 
                    ImageUrl="~/Pictures/imgLiked.jpg" style="text-align: center" 
                    Width="55px" />
                <asp:Label ID="lblTotalCounts" runat="server" Text="Label" Font-Size="Medium" 
                    BorderStyle="Inset" Width="57px"></asp:Label>
            <div class = "replaceLikeButton">
            
            
            
                <asp:Button ID="btnLike" runat="server" Height="28px" 
                    style="text-align: left" Text="Like This Image" Width="133px" 
                    Font-Bold="True" Font-Italic="True" />
            
            
                
            </div>
            
            </div>
            <div class = "addNewImageContent">
        
        
        
    <div class = "text20" 
        style="font-size: medium; font-style: italic; font-weight: bold">

        <br />
        Comments this photo...<br />
        <div class = "text20" 
            
            style="font-weight: normal; font-style: normal; font-size: small; height: 145px;"> 
            To add a comment to this image, simply enter your comment below and click 
            comment.<div class = "commentTexBox"> 
                <asp:TextBox ID="txtimagecomment" runat="server" BorderStyle="Solid" Height="77px" 
                    Width="481px" TextMode="MultiLine"></asp:TextBox>
                <asp:Button ID="btncomment" runat="server" Text="Comment" Width="132px" />
                <br />
                <br />
                <div class="step4b">
                    <div class="tagphototitle" 
                        
                        
                        style="font-weight: bold; font-size: medium; font-style: italic; height: 32px;">
                        Tag the Photo&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                        Current Tags</div>
                    <div class="tags">
                    <div class = "listOfAssignedTags">
                        
                        
                        
                        <div class = "postTagsInfo">
                        
                            <span class="style2">Below are the tags currently tagged on the image shown 
                            above</span>.
                        
                        </div>
                        
                        
                        
                            <asp:ListBox ID="ListBox1" runat="server" DataSourceID="SqlDataSource5" 
                                DataTextField="TagName" DataValueField="TagName" Height="101px" 
                                Width="245px" SelectionMode="Multiple" Font-Names="Calibri" 
                                Font-Size="Medium">
                            </asp:ListBox>
                            <asp:SqlDataSource ID="SqlDataSource5" runat="server" 
                                ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                                ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" 
                                
                            SelectCommand="SELECT Tags.TagName, Image_Tags.ImageIDFK, Image_Tags.ID FROM (Tags INNER JOIN Image_Tags ON Tags.TagID = Image_Tags.TagIDFK) WHERE (Image_Tags.ImageIDFK = ?) ORDER BY Image_Tags.ID DESC">
                                <SelectParameters>
                                    <asp:QueryStringParameter Name="?" QueryStringField="id" />
                                </SelectParameters>
                            </asp:SqlDataSource>
                        
                        
                        
                        </div>
                        <asp:Panel ID="Panel1" runat="server" Height="124px" ScrollBars="Vertical" 
                            Width="212px">
                            <asp:CheckBoxList ID="cbxtags" runat="server" datasourceid="SqlDataSource4" 
                                DataTextField="TagName" DataValueField="TagID" RepeatLayout="Flow">
                            </asp:CheckBoxList>
                            <asp:SqlDataSource ID="SqlDataSource4" runat="server" 
                                ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                                ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" 
                                
                                SelectCommand="SELECT [TagID], [TagName] FROM [Tags] ORDER BY [TagID] DESC"></asp:SqlDataSource>
                                <div class = "space"></div>
                            
                        </asp:Panel>


                        <asp:Button ID="btntagimage" runat="server" Height="28px" Text="Tag Image" 
                                Width="144px" />
                        <br />
                        

                    </div>
                    <div class="newTags">
                        <br />
                        To create a new tag, simply enter your tag name and click on Add.<br />
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br />
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <asp:TextBox ID="txtnewtag" runat="server" Width="252px"></asp:TextBox>
                        <br />
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <asp:Button ID="btnaddnewtag" runat="server" Height="28px" Text="Add New Tag" 
                            Width="144px" />
                    </div>

                </div>

            </div>
                </div></div> 

        
        
        </div>
        </div>
          
    </div>
  

    <div class = "text20" 
        style="font-size: medium; font-style: italic; font-weight: bold">

        User Comments for this Image</div>

        
    <br />
    <div class = "commentB">
        <asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource2">
            <AlternatingItemTemplate>
                <span style=""><strong>Comment:</strong> <span style=" color:#3366FF">
                <asp:Label ID="CommentBodyLabel" runat="server" 
                    Text='<%# Eval("CommentBody") %>' />
                </span>
                <br />
                <strong>Date Uploaded:</strong>
                <asp:Label ID="DateUploadedLabel0" runat="server" 
                    Text='<%# Eval("DateUploaded") %>' />
                <br />
                <strong>Time Uploaded:</strong>
                <asp:Label ID="TimeUploadedLabel0" runat="server" 
                    Text='<%# Eval("TimeUploaded") %>' />
                <br />
                <strong>Comment Posted by:</strong>
                 <a href="UserProfileView.aspx?Username=<%# Eval("UserName") %>"><asp:Label ID="UserNameLabel" runat="server" Text='<%# Eval("UserName") %>' /></a>
                <br />
                <br />
                </span>
            </AlternatingItemTemplate>
            <EditItemTemplate>
                <span style=""><strong>Comment:</strong> <span style=" color:#3366FF">
                <asp:TextBox ID="CommentBodyTextBox" runat="server" 
                    Text='<%# Bind("CommentBody") %>' />
                </span>
                <br />
                <strong>Date Uploaded:</strong>
                <asp:TextBox ID="DateUploadedTextBox1" runat="server" 
                    Text='<%# Bind("DateUploaded") %>' />
                <br />
                <strong>Time Uploaded:</strong>
                <asp:TextBox ID="TimeUploadedTextBox1" runat="server" 
                    Text='<%# Bind("TimeUploaded") %>' />
                <br />
                <strong>Comment Posted by</strong>
                <a href="UserProfileView.aspx?Username=<%# Eval("UserName") %>"><asp:Label ID="UserNameLabel" runat="server" Text='<%# Eval("UserName") %>' /></a>
                <br />
                <asp:Button ID="UpdateButton0" runat="server" CommandName="Update" 
                    Text="Update" />
                <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                    Text="Cancel" />
                <br />
                <br />
                </span>
            </EditItemTemplate>
            <EmptyDataTemplate>
                <span>No data was returned.</span>
            </EmptyDataTemplate>
            <InsertItemTemplate>
                <span style=""><strong>Comment:</strong> <span style=" color:#3366FF">
                <asp:TextBox ID="CommentBodyTextBox0" runat="server" 
                    Text='<%# Bind("CommentBody") %>' />
                </span>
                <br />
                <strong>Date Uploaded:</strong>
                <asp:TextBox ID="DateUploadedTextBox2" runat="server" 
                    Text='<%# Bind("DateUploaded") %>' />
                <br />
                <strong>Time Uploaded:</strong>
                <asp:TextBox ID="TimeUploadedTextBox2" runat="server" 
                    Text='<%# Bind("TimeUploaded") %>' />
                <br />
                <strong>Comment Posted by:</strong>
                 <a href="UserProfileView.aspx?Username=<%# Eval("UserName") %>"><asp:Label ID="UserNameLabel" runat="server" Text='<%# Eval("UserName") %>' /></a>
                <br />
                <asp:Button ID="InsertButton0" runat="server" CommandName="Insert" 
                    Text="Insert" />
                <asp:Button ID="CancelButton0" runat="server" CommandName="Cancel" 
                    Text="Clear" />
                <br />
                <br />
                </span>
            </InsertItemTemplate>
            <ItemTemplate>
                <span style=""><strong>Comment:</strong> <span style=" color:#3366FF">
                <asp:Label ID="CommentBodyLabel0" runat="server" 
                    Text='<%# Eval("CommentBody") %>' />
                </span>
                <br />
                <strong>Date Uploaded:</strong>
                <asp:Label ID="DateUploadedLabel1" runat="server" 
                    Text='<%# Eval("DateUploaded") %>' />
                <br />
                <strong>Time Uploaded:</strong>
                <asp:Label ID="TimeUploadedLabel1" runat="server" 
                    Text='<%# Eval("TimeUploaded") %>' />
                <br />
                <strong>Comment Posted by:</strong>
                 <a href="UserProfileView.aspx?Username=<%# Eval("UserName") %>"><asp:Label ID="UserNameLabel" runat="server" Text='<%# Eval("UserName") %>' /></a>
                <br />
                <br />
                </span>
            </ItemTemplate>
            <LayoutTemplate>
                <div ID="itemPlaceholderContainer" runat="server" style="">
                    <span runat="server" id="itemPlaceholder" />
                </div>
                <div style="">

                </div>
            </LayoutTemplate>
            <SelectedItemTemplate>
                <span style="">CommentBody:
                <span style="color: #3366FF">
                <asp:Label ID="CommentBodyLabel1" runat="server" 
                    Text='<%# Eval("CommentBody") %>' />
                </span>
                <br />
                DateUploaded:
                <asp:Label ID="DateUploadedLabel2" runat="server" 
                    Text='<%# Eval("DateUploaded") %>' />
                <br />
                TimeUploaded:
                <asp:Label ID="TimeUploadedLabel2" runat="server" 
                    Text='<%# Eval("TimeUploaded") %>' />
                <br />
                UserName:
                 <a href="UserProfileView.aspx?Username=<%# Eval("UserName") %>"><asp:Label ID="UserNameLabel" runat="server" Text='<%# Eval("UserName") %>' /></a>
                <br />
                <br />
                </span>
            </SelectedItemTemplate>
        </asp:ListView>
        <asp:DataPager ID="DataPager1" runat="server" PagedControlID="ListView1" PageSize="4">
            <Fields>
                <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" 
                    ShowNextPageButton="False" ShowPreviousPageButton="False" />
                <asp:NumericPagerField />
                <asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True" 
                    ShowNextPageButton="False" ShowPreviousPageButton="False" />
            </Fields>
        </asp:DataPager>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
            ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" 
            
            SelectCommand="SELECT Image_Comments.CommentBody, Image_Comments.DateUploaded, Image_Comments.TimeUploaded, aspnet_Users.UserName, Image_Comments.ImageID, Image_Comments.ImageCommentID FROM (Image_Comments INNER JOIN aspnet_Users ON Image_Comments.UserID = aspnet_Users.UserId) WHERE (Image_Comments.ImageID = ?) ORDER BY Image_Comments.ImageCommentID DESC">
            <SelectParameters>
                <asp:QueryStringParameter Name="?" QueryStringField="id" />
            </SelectParameters>
        </asp:SqlDataSource>
    </div>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
        ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" 
        SelectCommand="SELECT [ImageLink] FROM [Images] WHERE ([ImageID] = ?)">
        <SelectParameters>
            <asp:QueryStringParameter Name="ImageID" QueryStringField="id" Type="Int32" />
        </SelectParameters>
    </asp:SqlDataSource>
</asp:Content>
